#include<iostream>
using namespace std;
int main()
{
	int t = 0;
	cin >> t;
	while (t--)
	{
		int n = 0;
		cin >> n;
		int Sum = 0;
		int t = 0;
		int x = 2;
		for (x = 2;x <= n;x++)
		{
			int sum = 0;
			for (int i = 1;i*x <= n;i++)
			{
				sum += i*x;
			}
			if (sum > Sum)
			{
				Sum = sum;
				t = x;
			}
		}
		cout << t << endl;
	}
	return 0;
}